to Dynamic Fill Dp
EN Converts a Number (base Dp value) into a dynamically scaled Dp for use in Jetpack Compose.
The scaling logic:
Checks DimenCache first. On a cache hit, returns the precomputed value; otherwise, computes via calculateFillDpCompose and stores it.
Uses the internal bypass mechanism in DimenCache for sub-nanosecond latency on common width-scaling paths.
The remember block ensures recalculation only when configuration changes.
⚠️ Bypass note: when applyAspectRatio is
falseand qualifier isSMALL_WIDTHwithDEFAULTinverter, the cache is bypassed internally because a raw multiply (~2 ns) is faster than the cache lookup (~5 ns). This is intentional and not a bug.
PT Converte um Number (valor Dp base) em um Dp dinamicamente escalado para uso no Jetpack Compose.
A lógica de escalonamento:
Consulta o DimenCache primeiro. No acerto, retorna o Float cacheado; no miss, calcula via calculateFillDpCompose e armazena.
O bloco remember garante que o valor só seja recalculado quando um parâmetro de configuração realmente muda.
Return
Dynamically scaled Dp value.
Parameters
Screen dimension qualifier: DpQualifier.SMALL_WIDTH, DpQualifier.HEIGHT, or DpQualifier.WIDTH.
Orientation-based dimension swap rule (default: Inverter.DEFAULT).
If true, returns the base value unscaled when the app is in split-screen.
If true, applies aspect-ratio multiplier for more aggressive scaling.
Override for the AR sensitivity constant (null = library default).